package com.lms.logistics_management_system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lms.logistics_management_system.controller.dto.ElectricityPaymentDto;
import com.lms.logistics_management_system.entity.Announcement;
import com.lms.logistics_management_system.entity.ElectricityPayment;
import com.lms.logistics_management_system.mapper.ElectricityPaymentMapper;
import com.lms.logistics_management_system.service.AnnouncementService;
import com.lms.logistics_management_system.mapper.AnnouncementMapper;
import com.lms.logistics_management_system.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author LENOVO
* @description 针对表【announcement】的数据库操作Service实现
* @createDate 2023-02-22 23:05:13
*/
@Service
public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement>
    implements AnnouncementService{

    @Resource
    private AnnouncementMapper announcementMapper;

    public List<Announcement> getAllInfo() {
        return announcementMapper.getAllInfo();
    }

    @Override
    public Page<Announcement> getPageAnnouncement(Integer pageNum, Integer pageSize) {
        Page<Announcement> pageInfo = new Page(pageNum, pageSize);
        this.page(pageInfo);
        if(pageNum > pageInfo.getPages())
        {
            pageInfo.setCurrent(pageInfo.getPages());
            this.page(pageInfo);
        }
        return pageInfo;
    }
}




